import mainRouter from "./mainRouter"
const routerConfig = [
    {
        path: '/',
        redirect: "/head"
    }, {
        path: "/head",
        component: () => import("@/views/home.vue"),
        children: mainRouter
    }, {
        path: "/logins",
        component: () => import("@/views/login.vue")
    }
]

export const routerLink = (arr) => {
    arr.forEach((item) => {
        let mainRoute = mainRouter.filter(item=>item.meta)
        mainRoute.forEach(ite => {
            item.children = item.children || []
            if (ite.meta.classify === item.name) {        
                item.children.push({
                    name: ite.meta.title,
                    route: `/head/${ite.path}`,
                    id: item.id + "-" + (item.children ? item.children.length + 1 : 1)
                })
            }
        })
    })
    return arr
}
export default routerConfig